package net.bplaced.streetfighter.lib.service;

import java.util.ArrayList;
import java.util.List;

import net.bplaced.streetfighter.lib.model.MatchScore;
import net.bplaced.streetfighter.lib.utils.ServiceReturnPackage;

import org.apache.http.NameValuePair;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;

/**
 * @author Sebastian Hoffmann <bo.hoffi@googlemail.com>
 */
public class MatchScoreService
        extends CommonService<MatchScore> {

    public ServiceReturnPackage<MatchScore> loadMatchScoreViaPOST(String homeTeamName, String guestTeamName,
            String matchCategory) {

        final HttpPost httppost = new HttpPost("http://streetfighter.bplaced.net/services/MatchDetailPostService.php");

        final List<NameValuePair> parameters = new ArrayList<NameValuePair>(3);
        parameters.add(new BasicNameValuePair("ownTeam", homeTeamName));
        parameters.add(new BasicNameValuePair("opponent", guestTeamName));
        parameters.add(new BasicNameValuePair("category", matchCategory));

        return this.sendRequest(httppost, parameters, MatchScore.class);
    }
}